package com.gitee.loyo.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 充电设备接口类型
 */
@Getter
@AllArgsConstructor
public enum ConnectorType {
    HOUSEHOLD_SOCKET(1, "家用插座"),AC_SOCKET(2, "交流接口插座"),AC_PLUG(3, "交流接口插头"),DC_PLUG(4, "交流接口枪头"),WIRELESS(4, "无线充电座"),OTHER(6, "其他");

    private int code;
    private String text;

    public static ConnectorType valueOf(int code){
        switch (code){
            case 1: return HOUSEHOLD_SOCKET;
            case 2: return AC_SOCKET;
            case 3: return AC_PLUG;
            case 4: return DC_PLUG;
            case 5: return WIRELESS;
            case 6: return OTHER;
        }
        throw new UnsupportedOperationException("unknown code: " + code);
    }
}
